package comnet.ftpclient;

import java.io.IOException;

/**
 * @author Mikko Puustinen (mikko.puustinen@gmail.com)
 * @version 0.1, 2007-dec-07
 */
public class FtpClientRunner implements ChangeListener {
    FtpClient fc;

    public FtpClientRunner() throws IOException {
        fc = new FtpClient("localhost", 3014);
        fc.addChangeListenerClass(this);
    }

    public static void main(String[] args) throws IOException {
        //new UserHandler(null, new File(".")).sendFileListing(null);
        new FtpClientRunner().test();
    }

    private void test() {
        try {
            if (!fc.setConnection()) {
                System.err.println("Kunde ej ansluta: " + fc.getLastReply());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        while (true) {
        }

    }

    public void newServerReply() {
        System.out.println(">> " + fc.getLastReply());
    }

    public void changedDirectory() {
        Object[] list;
        list = new Object[0];

        for (Object o : list) {
            System.out.println(o);
        }
    }
}
